<!-- 物联网管理-环境管理-环境报警查看 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="空气项目">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="场地名称">
              <el-input v-model="listQuery.fuser" placeholder="请输入场地" clearable />
            </el-form-item>
          </el-col>

          <template v-if="showAll">
          
          <el-col :span="6">
           <el-form-item label="教学楼">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options2"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
           </el-form-item>
          </el-col>

          <el-col :span="6">
           <el-form-item label="楼层">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
           </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <!-- <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <el-button type="danger" icon="el-icon-download">导出</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FBILLCREDATE" label="报警日期" width="95"></el-table-column>
          <el-table-column prop="FPARENTNO" label="所属教学楼"></el-table-column>
          <el-table-column prop="FLAYNO" label="所属楼层" ></el-table-column>
          <el-table-column prop="FPOINT" label="场地名称"></el-table-column>
          <el-table-column prop="FCATNAME" label="空气项目"  width="85"></el-table-column>
          <el-table-column prop="FWARRINGVALUE" label="报警值"  width="65"></el-table-column>
          <el-table-column prop="FBEGTIME" label="开始时间"  width="75"></el-table-column>
          <el-table-column prop="FENDTIME" label="结束时间"  width="75"></el-table-column>
          <el-table-column prop="FBILLNO" label="报警单号"  width="90"></el-table-column>
          <el-table-column prop="FMEMO" label="报警说明" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '室外:PM2.5'
        }, {
          value: '2',
          label: '室外:PM10'
        }, {
          value: '3',
          label: '室内:温度'
        }],

        options2: [{
          value: '20E01',
          label: '第一教学楼'
        }, {
          value: '20E02',
          label: '第二教学楼'
        }, {
          value: '20N03',
          label: '化学楼'
        }, {
          value: '20E04',
          label: '综合实验楼'
        }],

        options3: [{
          value: '20E01',
          label: '一楼'
        }, {
          value: '20E02',
          label: '二楼'
        }, {
          value: '20N01',
          label: '三楼'
        }, {
          value: '20N02',
          label: '四楼'
        }],

        customlist:[
          {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME": "室外:PM2.5",
            "FMINVALUE":"125",
            "FMAXVALUE":"9999",
            "FMEMO":"室外环境不适合开展户外活动",
            "FEMAIL":"是",
            "FMESSAGE":"是",
            "FLEVEL":"中风险",
            "FBILLSTATE": "正常"
          },
        ],
        list: [
            {
            "FBILLCREDATE":"2024-12-05",
            "FPARENTNO":"第一教学楼",
            "FLAYNO":"一楼",
            "FPOINT":"奉1教楼101",
            "FCATNAME":"CO2",
            "FWARRINGVALUE":"900",
            "FBEGTIME":"11:50:00",
            "FENDTIME":"11:52:00",
            "FBILLNO":"K241130001",
            "FMEMO":"二氧化碳超标"

            },{
            "FBILLCREDATE":"2024-12-05",
            "FPARENTNO":"第一教学楼",
            "FLAYNO":"一楼",
            "FPOINT":"奉1教楼102",
            "FCATNAME":"CO2",
            "FWARRINGVALUE":"900",
            "FBEGTIME":"11:50:00",
            "FENDTIME":"11:52:00",
            "FBILLNO":"K241130001",
            "FMEMO":"二氧化碳超标"
            },
            ,{
            "FBILLCREDATE":"2024-12-05",
            "FPARENTNO":"第一教学楼",
            "FLAYNO":"一楼",
            "FPOINT":"奉1教楼103",
            "FCATNAME":"CO2",
            "FWARRINGVALUE":"900",
            "FBEGTIME":"11:50:00",
            "FENDTIME":"11:52:00",
            "FBILLNO":"K241130001",
            "FMEMO":"二氧化碳超标"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>